home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-01-12 | 1.6 KB | 44 lines | [TEXT/ToyS] |
- property calcDialog : {size:[250, 176], name:"Calculate Total", style:movable dialog, contents:[¬
- {class:push button, name:"Done", bounds:[180, 115, 240, 135]}, ¬
- {class:push button, name:"Calc.", bounds:[180, 146, 240, 166]}, ¬
- {class:static text, bounds:[60, 150, 155, 166]}, ¬
- {class:text field, name:"1995", bounds:[60, 25, 155, 41], name bounds:[10, 24, 50, 40]}, ¬
- {class:text field, name:"1996", bounds:[60, 50, 155, 66], name bounds:[10, 50, 50, 66]}, ¬
- {class:text field, name:"1997", bounds:[60, 75, 155, 91], name bounds:[10, 76, 50, 92]}, ¬
- {class:text field, name:"1998", bounds:[60, 100, 155, 116], name bounds:[10, 102, 50, 118]}, ¬
- {class:text field, name:"1999", bounds:[60, 125, 155, 141], name bounds:[10, 128, 50, 144]}, ¬
- {class:static text, contents:"Year", bounds:[10, 4, 50, 20]}, ¬
- {class:static text, contents:"Amount", bounds:[60, 4, 200, 20]}, ¬
- {class:static text, contents:"Total", bounds:[10, 150, 50, 166]}, ¬
- {class:group box, bounds:[60, 148, 155, 149]}, ¬
- {class:group box, bounds:[60, 166, 155, 166]} ¬
- ], default item:2}
-
- dd install with grayscale
- set d to dd make dialog calcDialog
- dd set value of items 4 thru 8 of d to [200, 300, 400, 500, 100]
- DoCalc(d)
- repeat
- set i to dd interact with user
- if i = 1 then exit repeat
- if i = 2 then DoCalc(d)
- end repeat
- dd uninstall
-
- on DoCalc(d)
- set tot to 0
- set dVals to dd get value of items 4 thru 8 of d
- set i to 4
- repeat with n in dVals
- try
- set tot to tot + n as number
- set i to i + 1
- on error
- dd set selection of item i of d to [0, -1]
- beep 2
- set tot to "?"
- exit repeat
- end try
- end repeat
- dd set contents of item 3 of d to tot
- end DoCalc